Skip to content

feat(mcp): compose preflight, slop-risk, and pr-text-lint into review-pr - #3791

Merged
loopover-orb[bot] merged 1 commit into
mainfrom
feat-mcp-review-pr-1968
Jul 6, 2026
Merged

feat(mcp): compose preflight, slop-risk, and pr-text-lint into review-pr#3791
loopover-orb[bot] merged 1 commit into
mainfrom
feat-mcp-review-pr-1968

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • Closes Local pre-PR review via the contributor's own agent #1968. Adds gittensory-mcp review-pr (and a matching gittensory_review_pr_before_push MCP tool) that composes the existing preflight (analyzeCurrentBranch), POST /v1/lint/slop-risk, and POST /v1/lint/pr-text checks into ONE pre-PR review report, so a contributor's own local agent (Claude Code, Codex, etc.) can run one command and see everything the gittensory gate would flag before ever opening a PR.
  • It is a thin composition layer: it does not reimplement any of the underlying checks, it calls the same API endpoints preflight/slop-risk/lint-pr-text already call and merges their output into { preflight, slopRisk, prTextLint, overallStatus, sections }.
  • Each sub-check is isolated with its own try/catch, so a single flaky endpoint degrades only that section to fail with a public-safe error reason (slopRiskError/prTextLintError) instead of losing the sections that did succeed — this fail-safe behavior has a dedicated regression test for each check.
  • doctor's default "next command" fallback (shown when no other diagnostic is more urgent) now points at review-pr instead of plain preflight, since it is the superset check a contributor should run before opening a PR. Updated the two existing doctor tests that asserted the old exact command string.
  • Documented the new command in packages/gittensory-mcp/README.md (usage line + a dedicated "Review your PR locally before you push" section) and in the CLI's own --help usage listing.

Design note (conservative scope decision): the issue's example name was predict-gate, but this package has no gittensory_predict_gate tool or /v1/predict-gate-style endpoint today — the closest existing "gate preflight" surface is preflight/analyzeCurrentBranch, which is what's composed here alongside slop-risk and PR-text lint. No new backend endpoint was added; this is CLI/MCP-package-only, per the issue's explicit "thin composition, don't reimplement" instruction.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked an issue, or this is small enough that the summary explains why an issue is not needed.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally; codecov/patch requires ≥99% coverage of the lines AND branches you changed (aim for 100% on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate. — not run: this change touches only packages/gittensory-mcp/** (plain .js, outside Codecov's src/**/*.ts include) and test/** (Codecov-ignored), so it owes no patch coverage; ran the full unsharded npx vitest run test/unit/ instead (490 files / 9889 tests passed) plus the new/changed MCP CLI test files directly.
  • npm run test:workers — not run; this change does not touch test/workers/** or any Cloudflare Worker code.
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check — not run; no API routes or OpenAPI schemas changed.
  • npm run ui:lint / npm run ui:typecheck / npm run ui:build — not run; no apps/gittensory-ui/** files changed.
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries — test/unit/mcp-cli-review-pr.test.ts (8 new tests: pass, warn/weak-lint, --body-file, slop-risk API failure degradation, pr-text-lint API failure degradation, missing --login, --help, typo-suggestion) plus updated test/unit/mcp-cli-doctor.test.ts assertions for the new default next-command string.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests. — N/A, no auth/CORS/session behavior changed (the new command reuses the existing apiPost auth requirement unchanged).
  • API/OpenAPI/MCP behavior is updated and tested where needed (new MCP tool gittensory_review_pr_before_push, tested via the equivalent CLI command against the same composed function).
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks. — N/A, no UI changes.
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots... — N/A, no visible UI changes (CLI/MCP package only).
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs — README updated; CHANGELOG.md untouched (generated at release).

UI Evidence

N/A — no visible UI changes; this PR is scoped to the @jsonbored/gittensory-mcp CLI/MCP package.

Notes

  • Verified locally: npm run typecheck, npm run actionlint, npm audit --audit-level=moderate, npm run build:mcp, npm run test:mcp-pack, npm run command-reference:check, npm run docs:drift-check all pass; npx vitest run test/unit/ (490 files / 9889 tests) passes in full.

Adds `gittensory-mcp review-pr` (and the matching `gittensory_review_pr_before_push`
MCP tool) so a contributor's own local agent can run one command and see
everything the gittensory gate would flag before ever opening a PR (#1968).

It is a thin composition layer: it calls the existing preflight
(analyzeCurrentBranch), POST /v1/lint/slop-risk, and POST /v1/lint/pr-text
checks and merges their output into one report with an overallStatus and a
per-check sections array. Each check is isolated so one flaky endpoint
degrades only its own section (with a public-safe error reason) instead of
losing the whole report.

Also points doctor's default next-command guidance at review-pr instead of
plain preflight, and documents the new command in the package README/help.

Validated with npm run typecheck, npm run build:mcp, npm run test:mcp-pack,
and npx vitest run across the mcp-cli-*.test.ts suite (89 passed) plus the
full unit suite (9889 passed).
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
gittensory-ui bba1bc7 Commit Preview URL

Branch Preview URL
Jul 06 2026, 10:13 AM

@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.33%. Comparing base (f15b832) to head (bba1bc7).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3791   +/-   ##
=======================================
  Coverage   93.33%   93.33%           
=======================================
  Files         317      317           
  Lines       32433    32433           
  Branches    11892    11892           
=======================================
  Hits        30270    30270           
  Misses       1530     1530           
  Partials      633      633           
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 6, 2026
@loopover-orb

loopover-orb Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Tip

🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩

✅ Gittensory review result - approve/merge recommended

Review updated: 2026-07-06 10:21:38 UTC

5 files · 1 AI reviewer · no blockers · readiness 100/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This is a thin, well-scoped composition layer: reviewLocalPr() wraps the existing analyzeCurrentBranch (preflight) plus two apiPost calls to /v1/lint/slop-risk and /v1/lint/pr-text, each isolated via runReviewCheck's try/catch so one flaky endpoint degrades only its own section instead of aborting the whole report. It reuses collectLocalDiff and publicSafeWorkspaceIntelligence rather than reimplementing any check, wires review-pr into the CLI spec/help/typo-suggestion and the gittensory_review_pr_before_push MCP tool, and updates doctor's default next-command plus its two existing tests. Test coverage is solid: success path, weak/warn PR-text verdict, --body-file, and both slop-risk and pr-text-lint 500/503 failure-isolation paths are all exercised, and CI is green including codecov/patch.

Nits — 6 non-blocking
  • packages/gittensory-mcp/bin/gittensory-mcp.js: sections' preflight status mapping only special-cases 'fail'/'warn' and defaults everything else (including any status value you haven't enumerated here, e.g. a future 'blocked') to 'pass' — worth confirming preflight's status enum is closed to fail/warn/ready so this doesn't silently mask a real failure.
  • reviewLocalPr only forwards input.linkedIssues?.[0] to pr-text-lint even though the CLI accepts multiple --linked-issue/--issue values — fine as a scope decision, but worth a one-line comment noting only the first is used, since a contributor passing several issue numbers may expect all of them considered.
  • The long-file/deep-nesting flags on gittensory-mcp.js are pre-existing structural debt this PR adds onto rather than introduces — not blocking, but another ~215 lines into an already-3700-line file is worth a mental note for a future split.
  • Consider extracting the review-pr CLI/tool wiring plus reviewLocalPr/runReviewCheck helpers into a small dedicated module now that gittensory-mcp.js is pushing 3800 lines, to keep the deep-nesting/long-file smells from compounding further.
  • Add a short doc note (or explicit runtime guard) that only the first --linked-issue is used by review-pr's pr-text-lint call, matching the nit above.
  • PR author also opened the linked issue — Link an issue that was opened by a different contributor, or provide a rationale for why this self-authored issue represents genuine discovery work.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #1968
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 54 registered-repo PR(s), 46 merged, 413 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 54 PR(s), 413 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, TypeScript, JavaScript, Ruby, Go, Kotlin, MDX, Shell
  • Official Gittensor activity: 54 PR(s), 413 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gittensory approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit 2fa43bb into main Jul 6, 2026
12 checks passed
@loopover-orb
loopover-orb Bot deleted the feat-mcp-review-pr-1968 branch July 6, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Local pre-PR review via the contributor's own agent

1 participant